Image processing devices generally recognize the shape and type of object obtained as image information in two steps: first, they establish a so called `window` to designate the region of the input image which is to be recognized; and second, they measure various feature parameters of the image within the window such as its surface area and center of gravity.
FIGS. 11A-11C illustrate a process used to establish a window. In FIG. 11a the input image 1 is obtained by imaging the given object through an appropriate imaging device. The input image 1, having an identifiable portion 1a, is then displayed on the display screen of a video monitor of the image processing device (not shown).
While viewing the display screen, as shown in FIG. 11B, the operator uses a mouse or other appropriate input device to enter various points P.sub.i which define the region(s) which the system recognizes, i.e., image comparisons with scanned objects that are to be performed. This region consists of the area in and around portion 1a of the image. The coordinates of points P.sub.i are then sent to the image processing device, which creates a polygonal window 2 by connecting the operator-identified points P.sub.i to each other with straight lines.
Another embodiment which can be used to create such a window is shown in FIG. 11C. In this embodiment, the operator can input predetermined standard shapes 3 and 4, which may be circles, squares, or other geometrical shapes large enough to contain portion 1a of the image. The image processing device then creates a window 5 in a fashion similar to that described above by combining standard FIGS. 3 and 4.
When the first conventional embodiment shown in FIG. 11B is used, the operator must enter a large number of points P.sub.i, which is a troublesome process. In other words, if only a small number of points P.sub.i are entered, it is difficult to create a window 2 which conforms to the shape of the portion 1a of the image. In this case, there is a danger that the portion 1a of the image will protrude over the edge of the window 2 which has been generated. Beyond being inexact, the process is usually time consuming.
With the latter embodiment of FIG. 11C, a number of standard figures must be combined if the shape of portion 1a of the image is at all complex. This process can become unwieldy, and it is difficult to create, using only the standard figures, a window 5 which conforms to the contour of portion 1a.
FIGS. 12A-12C illustrate another embodiment for creating a window which eliminates the aforementioned problems. In this embodiment, the object is imaged and a gray image 6 is generated in FIG. 12a which will in turn be used to create a recognition window. The gray image 6 is binarized, and the binary image 7 is stored in the image memory (FIG. 12B).
In FIG. 12C, the same binary image is sent to the window memory, where an expanding or shrinking process is performed on it to create the expanded image 8 (FIG. 12D) or a shrunken image 9 (FIG. 12E). Images 8 and 9 are both binary images. The portion labeled 10a is the region 8 the image containing the black pixels; the white area labeled 10b is the region containing the white pixels. Images 8 and 9 are established as windows for input image 11.
To use these windows, for example, if an operator was inspecting objects for burrs or bulges, he would use a window consisting of the aforementioned expanded image 8 since these defects are accentuated. By totalling the black pixels within the window and comparing the total with a reference value, it would be possible for him to detect the presence or absence of burrs or bulges. If a operator was inspecting an object for chips or dents, he would use a window constructed from the aforementioned shrunken image 9 since the chips or dents would be more apparent. By totalling the black pixels within the window and comparing the total with a reference value, it would be possible to detect the presence or absence of chips or dents.
However, the embodiments using the windows described above suffer from the following problem. When the defects, whether they be burrs, bulges, chips, dents, etc., are microscopic, the difference between the total of number black pixels 10a within the window for a normal object and for a defective piece would not be obvious. For this reason it is difficult to perform a highly accurate inspection for defects. As a result, an inspection with a high degree of accuracy is impossible to perform.